package com.example.controller;

import com.example.common.Result;
import com.example.entity.MedicationLogs;
import com.example.service.MedicationLogsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/medicationLogs")
public class MedicationLogsController {
    @Resource
    private MedicationLogsService medicationLogsService;

    //按时吃药
    @PostMapping("/up")
    public Result upMedication(@RequestBody MedicationLogs medicationLogs){
        return medicationLogsService.upMedication(medicationLogs);
    }

    @PostMapping("/list")
    public Result list(@RequestBody MedicationLogs medicationLogs){
        return medicationLogsService.list(medicationLogs);
    }

    @PostMapping("/listAll")
    public Result listAll(){
        return medicationLogsService.listAll();
    }

    @PostMapping("/list/today")
    public Result listToday(@RequestBody MedicationLogs medicationLogs){
        return medicationLogsService.listToday(medicationLogs);
    }
}
